﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using dbPoll_Application.Models;

namespace dbPoll_Application.ViewModels
{
    public class MCQResponseViewModel
    {
        public MultipleChoiceQuestion question { get; set; }
        public List<int> responses { get; set; }
        public MultiSelectList optionList { get; private set; }
        public String feedback { get; set; }

        public MCQResponseViewModel(MultipleChoiceQuestion question)
        {
            this.question = question;
            this.optionList = GetResponses(null);
        }


        public MultiSelectList GetResponses(int[] selectedValues)
        {
            List<QuestionOption> options = new List<QuestionOption>();

                foreach (var option in question.options)
                {
                    options.Add(option);
                }

                return new MultiSelectList(options, "optionNumber", "answer", selectedValues);
        }

    }
}
